<template>
	<view class="contain flex f-c .f-j-start" >
		<view v-if="!isXcx" class="padding-15">
			<!-- #ifndef H5 -->
			<view :style="{'padding-top': top+30+'px'}"></view>
			<!-- #endif -->
			<view class="padding-20"></view>
			<view class="padding-6"></view>
			<view class="padding-lr12"  v-if="currentlogin==0" >
				<view class="f20-size f-w-b">{{i18n['手机号密码登录']}}</view>

				<view class="padding-tb6"></view>
				<view class="flex h-50 b-radius-30 bg-color-f1 margin-t8">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">+86</view>
					<view class="flex flex-1 padding-lr12">
						<input class="f16-size" v-model="phone" type="number" maxlength="11" :placeholder="i18n['请输入登录账号']">
					</view>
				</view>
				<view class="flex h-50 b-radius-30 bg-color-f1 margin-t8">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">
						<image class="w-20" src="https://qiniu.ccchongya.com/login_passport.png" mode="widthFix"></image>
					</view>
					<view class="flex flex-1 padding-lr12">
						<input class="f16-size" v-model="password" type="password" :placeholder="i18n['请输入登录密码']">
					</view>
				</view>
				<!-- <view class="flex h-50 b-radius-30 bg-color-f1 margin-t8 over-h">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">
						<image class="w-20" src="https://qiniu.ccchongya.com/login_code.png" mode="widthFix"></image>
					</view>
					<view class="flex flex-1 padding-lr12">
						<input v-model="code" type="number" :placeholder="i18n['图形验证码']">
					</view>
					<view class="flex f-a-c f-s-0">
						<img-code ref="imgCode" class="flex  h-30"></img-code>
					</view>
				</view> -->
				<view @click="login"
					class="flex f-a-c f-j-c b-radius-30 h-44 bg-color-linear-y t-color-w f-w-500 margin-t20">
					{{i18n['登录']}}
				</view>


			</view>
			<view class="padding-lr12" v-if="currentlogin==1">
				<view class="f20-size f-w-b">验证码登录</view>

				<view class="padding-tb6"></view>

				<view class="flex h-50 b-radius-30 bg-color-f1 margin-t8">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">+86</view>
					<view class="flex flex-1 padding-lr12">
						<input class="f16-size" v-model="phone" type="number" maxlength="11" :placeholder="i18n['请输入登录账号']">
					</view>
				</view>
				<view class="flex h-50 b-radius-30 bg-color-f1 margin-t8 over-h">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">
						<image class="w-20" src="https://qiniu.ccchongya.com/login_code.png" mode="widthFix"></image>
					</view>
					<view class="flex flex-1 padding-lr12">
						<input class="f16-size" v-model="code" type="number"  :placeholder="i18n['请输入验证码']">
					</view>
					<view class="flex f-a-c f-s-0">
						<img-code ref="imgCode" @imgSuc="getImgCode" class="flex  h-30"></img-code>
					</view>
				</view>
				<view class="flex h-50 b-radius-30 bg-color-f1 margin-t8">
					<view class="flex  f-a-c f-j-c f-s-0 icon-item f-w-b">
						<image class="w-20" src="https://qiniu.ccchongya.com/login_code.png" mode="widthFix"></image>
					</view>
					<view class="flex flex-1 padding-lr12">
						<input class="f16-size" v-model="sms" type="tel"  :placeholder="i18n['请输入手机验证码']">
					</view>
					<view class="padding-6">
						<phone-code ref="phonecode" :codeImg="codeImg" :code="code" :phone="phone"  :sendType="3"  ></phone-code>
					</view>
				</view>



				<view @click="loginSms"
					class="flex f-a-c f-j-c b-radius-30 h-44 bg-color-linear-y t-color-w f-w-500 margin-t20">
					{{i18n['登录']}}
				</view>


			</view>
			

		
				<view lass="padding-15 safe-area box-c" :style="isIphonex ? 'padding-bottom:34px;' : ''">
							<view class="flex f-a-c f-j-c ">
								<!-- #ifdef MP-WEIXIN -->
								<button class="flex f-a-c bg-color-f7 h-36 b-radius-30 padding-lr15" @click="getUserInfoxcx">
									<image class="w-20 margin-r4" src="https://qiniu.ccchongya.com/wx_icon.png" mode="widthFix"></image>
									<text>{{i18n['微信快捷登录']}}</text>
								</button>
								<!-- #endif -->
							</view>
							<view class="flex f-a-c margin-t12">
								<view class="padding-6"></view>
								<text @click="isAgree = !isAgree"  :class="isAgree ? 'van-icon-checked t-color-y' : 'van-icon-circle t-color-b'" class="flex f-a-c f-j-c van-icon  f16-size margin-r4"></text>
								<text @click="isAgree = !isAgree"   class="margin-r4 flex f-s-0">{{i18n['已阅读并同意']}}</text>
								<text @click="go('/pages/user/rules?type=1')" class="t-color-blue1 margin-r4  flex f-s-0">《{{i18n['用户协议']}}》</text>
								<text @click="go('/pages/user/rules?type=2')" class="t-color-blue1  flex f-s-0">《{{i18n['隐私政策']}}》</text>
							</view>
							<view class="padding-6"></view>

				</view>
				<view class="padding-lr12">
						<!-- <view class="flex f-j-c ">
								<view @click="go('/pages/user/passport/register')" class="f12-size  padding-tb20">验证码登录</view>
						</view> -->
					<view class="flex f-j-s ">
				
							<view  v-if="currentlogin==0" @click="currentlogin=1" class="f14-size  padding-tb10">验证码登录</view>
							<view  v-if="currentlogin==1" @click="currentlogin=0" class="f14-size  padding-tb10">账号密码登录</view>
				
				
						<view @click="go('/pages/user/passport/password')" class="flex f-a-c">
							<text @click="go('/pages/user/passport/register')" class="f14-size   t-color-y margin-r10">立即注册</text>
							<text class="f14-size ">忘记了？</text>
							<text class="f14-size t-color-y1">{{i18n['找回密码']}}</text>
						</view>
					</view>
				</view>
				<view class="appLogin margin-12" v-if="!appLoginStatus && !appleLoginStatus">
					<view class="hds">
						<text class="line"></text>
						<text>其他方式登录</text>
						<text class="line"></text>
					</view>
					<view class="btn-wrapper">
						<view class="btn wx" @click="wxLogin">
							<text class="myicon myicon-weixin  t-color-w"></text>
						</view>
						<view class="btn mima" v-if="currentlogin == 0" @click="currentlogin =1">
							<text class="myicon myicon-mimadenglu t-color-w"></text>
						</view>
						<view class="btn yanzheng" v-if="currentlogin == 1" @click="currentlogin =0">
							<text class="myicon myicon-yanzhengma  t-color-w"></text>
						</view>
					<!-- 	<view class="btn apple-btn" @click="appleLogin" v-if="appleShow">
							<view class="myicon myicon-pingguo  t-color-w"></view>
						</view> -->
					</view>
				</view>
				
				
		</view>








			<block v-else>
		
				
				<view>
								<view class="padding-lr12">
									<view class="padding-20"></view>
									<view style="padding-top: 20vh;"></view>
									<view class="f30-size f-w-b flex f-a-c f-j-c">{{i18n['登录之后更精彩']}}</view>
								</view>
								<view class="flex f-a-c f-j-c f-c margin-t20">
									<button  style="width: 68%;border-radius: 100px;" class="flex f-a-c f-j-c  bg-color-f7 h-36  padding-lr15" @click="getUserInfoxcx">
										<image class="w-20 margin-r4" src="https://qiniu.ccchongya.com/wx_icon.png" mode="widthFix"></image>
										<text class="f14-size">{{i18n['微信快捷登录']}}</text>
									</button>
								
									
									<view @click="back(1)" style="width: 68%;border-radius: 100px;" class="flex f-a-c f-j-c  bg-color-f7 h-40  padding-lr15 margin-t20">{{i18n['暂不登录']}}</view>
								</view>
								<view></view>
				</view>
				<view lass="padding-15 safe-area box-c" :style="isIphonex ? 'padding-bottom:34px;' : ''">
							
								<view class="flex f-a-c  f-j-c margin-t15" style="width:100%">
					
									<text @click="isAgree = !isAgree"  :class="isAgree ? 'van-icon-checked t-color-y' : 'van-icon-circle t-color-b'" class="flex f-a-c f-j-c van-icon  f16-size margin-r4"></text>
									<text @click="isAgree = !isAgree"   class="margin-r4 flex f-s-0">{{i18n['已阅读并同意']}}</text>
									<text @click="go('/pages/user/rules?type=1')" class="t-color-blue1 margin-r4  flex f-s-0">《{{i18n['用户协议']}}》</text>
									<text @click="go('/pages/user/rules?type=2')" class="t-color-blue1  flex f-s-0">《{{i18n['隐私政策']}}》</text>
							
								</view>
								<view class="padding-6"></view>
						
				</view>

			</block>
			<xieyi ref='xieyi' @agree="agree"></xieyi>
			
	</view>
</template>
<script>
	import xieyi from '@/pages/user/components/xieyi.vue';
	import imgCode from '@/components/common/imgcode.vue';
	import phoneCode from '@/components/common/phonecode.vue';
	const $ = require('@/utils/api.js');
	const api = require('@/utils/validate.js');

	import wechat from "@/utils/libs/wechat";
	import {
		Debounce
	} from '@/utils/libs/uniApi.js'
	import util from "@/utils/tools";


	import {
		getLoginConfig,
		appAuth,
		appleLogin,
		wechatAuth
	} from "@/utils/api/public";


	let nums = 0;
	export default {
		data() {
			return {
				currentlogin: 0,

				top: uni.getStorageSync('bartop') ? uni.getStorageSync('bartop') : 0,
				isIphonex: uni.getStorageSync('isIphonex') ? uni.getStorageSync('isIphonex') : false,
				phone: '',
				password: '',
				sms: '',
				code: '',
				codeImg: '',
				isAgree: false,
				// url: '',
				isXcx: false,


				platform: '',
				appLoginStatus: false, // 微信登录强制绑定手机号码状态
				appUserInfo: {}, // 微信登录保存的用户信息
				appleLoginStatus: false, // 苹果登录强制绑定手机号码状态
				appleUserInfo: null,
				appleShow: false, // 苹果登录版本必须要求ios13以上的
				// theme: app.globalData.theme,


			};
		},
		onLoad: function(options) {


			let self = this
			this.url = options.url ? options.url : '';
			this.init();
			// #ifdef MP-WEIXIN
					console.log("11111111111")
			this.getToken();
			this.isXcx = true;
			console.log("this.isXcx",this.isXcx)
			// #endif


			uni.getSystemInfo({
				success: function(res) {
					if (res.platform.toLowerCase() == 'ios' && res.system.split(' ')[1] >= '13') {
						self.appleShow = true
						self.platform = res.platform
					}
				}
			});

		},

		mounted: function() {
			this.getCode();
			this.getLoginconfig();
		},

		methods: {
			async getLoginconfig() {
				let that = this;
				getLoginConfig().then(res => {
					that.logoUrl = res.data.logo ? res.data.logo : 'https://qiniu.ccchongya.com/logo2.png';
				});
			},
			// 苹果登录
			appleLogin() {
				let self = this
				this.phone = ''
				this.captcha = ''
				// if (!this.isAgree) return util.Tips({
				// 	title: this.$t(`message.login.agreement`)
				// });

				if (!self.isAgree) {
					// $.$toast(self.i18n['请阅读并同意用户协议']);
					self.$refs.xieyi.open();
					return;
				}
				uni.showLoading({
					title: '登录中'
				})
				uni.login({
					provider: 'apple',
					timeout: 10000,
					success(loginRes) {
						uni.hideLoading();
						uni.getUserInfo({
							provider: 'apple',
							success: function(infoRes) {
								self.appleUserInfo = infoRes.userInfo
								self.appleLoginApi()
							},
							fail() {
								uni.hideLoading();
								uni.showToast({
									title: '获取用户信息失败',
									icon: 'none',
									duration: 2000
								})
							},
							complete() {
								uni.hideLoading()
							}
						});
					},
					fail(error) {
						uni.hideLoading()
					}
				})
			},
			// 苹果登录Api
			appleLoginApi() {
				appleLogin({
					openId: this.appleUserInfo.openId,
					email: this.appleUserInfo.email == undefined ? '' : this.appleUserInfo.email,
					identityToken: this.appleUserInfo.identityToken || ''
				}).then((res) => {
					let data = res.data;
					// this.$store.commit("LOGIN", {
					// 	'token': data.token
					// });
					if (data.isNew && data.newPeopleCouponList && data.newPeopleCouponList.length !== 0) {
						this.$Cache.set('newGift', data.newPeopleCouponList);
					} else {
						this.$Cache.clear('newGift');
					}
					this.getUserInfo(data);
				}).catch(error => {
					uni.hideLoading();
					uni.showModal({
						title: '提示',
						content: `错误信息${error}`,
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					});
				})
			},
			// App微信登录
			wxLogin: Debounce(function() {
				this.phone = ''
				this.captcha = ''
				// uni.showToast({
				// 	title: '登录失败',
				// 	icon: 'none',
				// 	duration: 2000
				// })
				let self = this
				// if (!this.isAgree) return util.Tips({

				// 	title: this.$t(`message.login.agreement`)
				// });

				if (!self.isAgree) {

					// $.$toast(self.i18n['请阅读并同意用户协议']);
					self.$refs.xieyi.open();
					return;
				}

				uni.showLoading({
					title: '登录中'
				})

				// this.weixinlogoBuyResinfo()
				this.weixinlogoBuyCode()




			}),
			// weixinlogoBuyResinfo(){
			// 		let self = this
			// 		uni.login({
			// 			provider: 'weixin',
			// 			onlyAuthorize: true,
			// 			success: function(res) {
			// 				uni.hideLoading();
			// 				let loginRes = res.authResult;
			// 				self.appUserInfo.openId = loginRes.openid;
			// 				self.appUserInfo.unionId = loginRes.unionid;
			// 				self.appUserInfo.type = self.platform === 'ios' ? 'iosWx' : 'androidWx';
			// 				self.wxLoginGo(self.appUserInfo)
			// 			},
			// 			fail(err) {
			// 			                       			console.log(err)
			// 											console.log(err.code+err.errMsg)
			// 			                       		uni.hideLoading()
			// 			                       		uni.showToast({
			// 			                       			title: '登录失败1111'+err.code+err.errMsg,
			// 			                       			icon: 'none',
			// 			                       			duration: 2000
			// 			                       		})
			// 			}
			// 		});
			// },
			weixinlogoBuyCode(){
					// $.go('/pages/home/index');return ;
					let self = this
								uni.getProvider({
									service: 'oauth',
									success: function(res) {
										console.log(res);
										//支持微信、qq和微博等
										if (res.provider.indexOf('weixin') != -1) {



												console.log("weixinweixinweixinweixin");
										   uni.login({
											provider: 'weixin',
											onlyAuthorize: true,
											success: function(res) {
												console.log(res)
												let code = res.code;
												console.log("code",code)
												wechatAuth(code,self.$Cache.get('spread')).then(res => {
													console.log("res",res)
													uni.setStorageSync('token', res.data.tokenHead + ' ' + res.data.token);
													console.log('res.data.tokenHead', res.data.tokenHead)
													console.log('res.data.tokenHead',res.data.token)
													// uni.setStorageSync('userInfo', res.data.member);
													$.$toast(self.i18n['登录成功']);

													if (res.data.type === 'bindphone') {
														$.go('/pages/wxAuth/bindphone?authKey=' + res.data.id);return ;
													}else{
														if(self.url != '') {
															uni.setStorageSync('backToPage',self.url);
														}
														self.goPage()

													}
												}).catch(e => {
													console.log("appAuth2222222 error",e)

												});
												// uni.hideLoading();
												// let loginRes = res.authResult;
												// self.appUserInfo.openId = loginRes.openid;
												// self.appUserInfo.unionId = loginRes.unionid;
												// self.appUserInfo.type = self.platform === 'ios' ? 'iosWx' : 'androidWx';
												// self.wxLoginGo(self.appUserInfo)
											},
											fail(err) {
													console.log(err)
												uni.hideLoading()
												uni.showToast({
													title: '登录失败222'+err.code+err.errMsg,
													icon: 'none',
													duration: 2000
												})
											}
										   });
										}
									},
									fail: function(err) {
										uni.hideLoading()
										uni.showToast({
											title: "请求微信授权失败",
											icon:"none"
										})
										console.log(err);
									},
								})
			},

			// wxLoginGo(userInfo) {
			// 	const self = this;
			// 	console.log("wxLoginGo userInfo",userInfo)


			// 	appAuth(userInfo).then(res => {

			// 					console.log("appAuth11 success")
			// 					console.log(res)
			// 		let data = res.data;



			// 		uni.setStorageSync('token', res.data.tokenHead + ' ' + res.data.token);
			// 		console.log('res.data.tokenHead', res.data.tokenHead)
			// 				console.log('res.data.tokenHead',res.data.token)
			// 		// uni.setStorageSync('userInfo', res.data.member);
			// 		$.$toast(self.i18n['登录成功']);


			// 		if (data.type === 'bindphone') {
			// 			uni.navigateTo({
			// 				// url: '/pages/users/app_login/index?authKey=' + data.key
			// 				url: '/pages/wxAuth/bindphone?authKey=' + data.key


			// 			})
			// 		}else{
			// 			if(self.url != '') {
			// 				self.go(self.url, 2, 2000);
			// 			}else {
			// 				self.go('/pages/home/index', 3, 2000);
			// 			}
			// 			self.socket.close();
			// 			self.socket.creatSocket({
			// 				onMessage(res) {}
			// 			})
			// 		}


			// 	}).catch(e => {
			// 		console.log("appAuth22 error",e)

			// 		// util.Tips({
			// 		// 	title: res
			// 		// });
			// 	});
			// },
			getImgCode(res) {
				this.codeImg = res;
			},
			getToken(a, b, user) {
				
				const self = this;
				
					console.log("getToken res:11111")
				// 登录获取token
				$.getToken().then(res => {
					console.log("getToken res:")
					if (res.errMsg == 'request:ok') {
						switch (res.data.code) {
							case 200:
								let data = res.data.data;
								uni.setStorageSync('session_key', data.session_key);
								uni.setStorageSync('xcxopenid', data.openid);
								uni.setStorageSync('unionid', data.unionid);
								nums += 1;
								if (a) {
									if (nums >= 6) {
										nums = 0;
										uni.showToast({
											title: '授权失败,请重新授权',
											icon: 'none'
										});
									} else {
										self.postUserInfo(a, b, user, data.session_key);
									}
								}


						}
					}
				});
			},

			getUserInfo(data) {
				this.$store.commit('UPDATE_USERINFO', {
					avatar: data.avatar,
					nickname: data.nickname,
					phone: data.phone
				});
				this.$store.commit("SETUID", data.id);
				let backUrl = this.$Cache.get(BACK_URL) || "/pages/home/index";
				if (backUrl.indexOf('/pages/users/login/index') !== -1) {
					backUrl = '/pages/home/index';
				}
				uni.reLaunch({
					url: backUrl
				});
			},
			/**
			 * 从微信服务器获取用户信息
			 */
			getUserInfoxcx: function(e) {
				const self = this;
				if (!self.isAgree) {
					// $.$toast(self.i18n['请阅读并同意用户协议']);
					self.$refs.xieyi.open();
					return;
				}
				uni.showLoading({
					title: '登录中'
				})
				
				uni.getUserProfile({
					desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
					success: res => {
						uni.hideLoading();
						// 提交用户数据
						let encryptedData = res.encryptedData;
						let iv = res.iv;
						this.postUserInfo(encryptedData, iv, res.userInfo);

					}
				});

			},
			/**
			 * 提交用户信息
			 */
			postUserInfo: function(a, b, user, session_key) {
				const self = this;
				if (!session_key) {
					session_key = ''
				};
				// if (!uni.getStorageSync('unionid')) {//公众号和小程序一起才需要unionid
				// 	self.getToken(a, b, user);
				// 	return;
				// }
				if (!uni.getStorageSync('session_key') && session_key != '') {
					self.getToken(a, b, user);
					return;
				}
				let postData = {
					encryptedData: a,
					iv: b,
					sessionKey: session_key != '' ? session_key : uni.getStorageSync('session_key'),
					openId: uni.getStorageSync('xcxopenid'),
					unionId: uni.getStorageSync('unionid'),
				};
				$.ajax({
					url: 'common/xcx/regitser',
					data: postData,
					method: 'POST',
					complete(res) {
							uni.hideLoading();
						if (res.data && res.data.token) {
							uni.setStorageSync('token', res.data.tokenHead + ' ' + res.data.token);
							
							
						} else {
							//'session_key'本地缓存过期
							// uni.removeStorageSync('session_key');
							// session_key 已经失效，需要重新执行登录流程
							self.getToken(a, b, user);

							return;
						}
						if (res.code == 200) {
							uni.showToast({
								title: '登录成功',
								icon: 'none'
							});

							self.getUser();
							
						}
					}
				});
			},
			agree() {
				this.isAgree = true;
			},
			loginSms(){
				const self = this;

				if (this.phone == '') {
					this.$toast(self.i18n['请输入登录账号']);
					return;
				}
				// if (this.password == '' || this.password.length < 6) {
				// 	this.$toast(self.i18n['请输入正确密码']);
				// 	return;
				// }
				if (this.sms == '' || this.sms.length < 6) {
					this.$toast(self.i18n['请输入验证码']);
					return;
				}


				// if (this.code == '') {
				// 	this.$toast(self.i18n['请输入图形验证码']);
				// 	return;
				// }
				if (!self.isAgree) {
					// $.$toast(self.i18n['请阅读并同意用户协议']);
					self.$refs.xieyi.open();
					return;
				}
				$.ajax({
					url: 'common/loginSms',
					data: {
						type: 1,
						username: this.phone,
						code: this.sms,
						registrationId: '', //	极光注册ID
						// cToken: self.$refs.imgCode.code.cToken,
						// captcha: self.code,
					},
					success(res) {
						uni.setStorageSync('token', res.data.tokenHead + ' ' + res.data.token);
						uni.setStorageSync('userInfo', res.data.member);


						// this.$mStore.commit('login', r.data);


						$.$toast(self.i18n['登录成功']);

						self.socket.close();
						self.socket.creatSocket({
							onMessage(res) {}
						})

						if(self.url != '') {
							uni.setStorageSync('backToPage',self.url);
						}
						self.goPage()
					}
				});
			},
			login() {
				const self = this;

				if (this.phone == '') {
					this.$toast(self.i18n['请输入登录账号']);
					return;
				}
				if (this.password == '' || this.password.length < 6) {
					this.$toast(self.i18n['请输入正确密码']);
					return;
				}
				// if (this.code == '') {
				// 	this.$toast(self.i18n['请输入图形验证码']);
				// 	return;
				// }
				if (!self.isAgree) {
					$.$toast(self.i18n['请阅读并同意用户协议']);
					self.$refs.xieyi.open();
					return;
				}
				$.ajax({
					url: 'common/login',
					data: {
						username: this.phone,
						password: this.password,
						type: 1,
						registrationId: '', //	极光注册ID
						// cToken: self.$refs.imgCode.code.cToken,
						// captcha: self.code,
					},
					success(res) {
						uni.setStorageSync('token', res.data.tokenHead + ' ' + res.data.token);
						uni.setStorageSync('userInfo', res.data.member);
						$.$toast(self.i18n['登录成功']);



						self.socket.close();
						self.socket.creatSocket({
							onMessage(res) {}
						})


						if(self.url != '') {
							uni.setStorageSync('backToPage',self.url);
						}
						self.goPage()
					}
				});
			},
			getUser: function() {
						const self = this;
						$.ajax({
							url: 'member/getUser',
							data: {},
							method: 'GET',
							success(res) {
								uni.setStorageSync('userInfo', res.data);
								if(!res.data.phone) {//无绑定手机情况下前往绑定手机
									// $.go('/pages/wxAuth/bindphone',2);
										self.$mRouter.reLaunch({ route: '/pages/wxAuth/bindphone' });
								}else{

									self.socket.close();
									self.socket.creatSocket({
										onMessage(res) {}
									})

									if(self.url != '') {
										uni.setStorageSync('backToPage',self.url);
									}
									self.goPage()

								}
							}
						});
					},
			init() {},
			goPage(){
				const backToPage = uni.getStorageSync('backToPage');
				uni.removeStorageSync('backToPage');
				if (backToPage) {
					if (
						backToPage.indexOf('/pages/profile/profile') !== -1 ||
						backToPage.indexOf('/pages/home/index') !== -1 ||
						backToPage.indexOf('/pages/category/category') !== -1
					) {
						this.$mRouter.reLaunch(JSON.parse(backToPage));
					} else {
						this.$mRouter.redirectTo(JSON.parse(backToPage));
					}
				} else {
					this.$mRouter.reLaunch({ route: '/pages/profile/profile' });
				}
			}


		},
		computed: {
			i18n() {
				return this.$t('login')
			},
		},
		created() {},
		mounted() {},
		destroyed() {},
		components: {phoneCode,imgCode,xieyi},
		onPullDownRefresh() {},
		onReachBottom() {}
	}
</script>
<style scoped>
	@import url('@/static/css/passport/login.css');
	@import url('@/static/css/page/white.css');


	/* .appLogin {margin-top: 60rpx;}

	.appLogin	.hds {
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 24rpx;
	color: #B4B4B4;
	}

	.appLogin			.line {
	width: 68rpx;
	height: 1rpx;
	background: #CCCCCC;
	}

	.appLogin			.line 	p {
	   margin: 0 20rpx;
	}

	.appLogin		.btn-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 30rpx;
	}
	.appLogin		.btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 68rpx;
	height: 68rpx;
	border-radius: 50%;
	}

	.appLogin		.apple-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: 30rpx;
	background: #000;
	border-radius: 34rpx;
	font-size: 40rpx;
	}
	.appLogin	.icon-s-pingguo {
	color: #fff;
	font-size: 40rpx;
	}


	.appLogin	.iconfont {font-size: 40rpx;color: #fff;}

	.appLogin   .wx {margin-right: 30rpx;background-color: #61C64F;}

	.appLogin	.mima {background-color: #28B3E9;}
	.appLogin	.yanzheng {background-color: #F89C23;}
	 */
</style>
<style scoped lang="scss">


	.appLogin {
		margin-top: 0;

		.hds {
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 24rpx;
			color: #B4B4B4;

			.line {
				width: 68rpx;
				height: 1rpx;
				background: #CCCCCC;
			}

			p {
				margin: 0 20rpx;
			}
		}

		.btn-wrapper {
			display: flex;
			align-items: center;
			justify-content: center;
			margin-top: 30rpx;

			.btn {
				display: flex;
				align-items: center;
				justify-content: center;
				width: 68rpx;
				height: 68rpx;
				border-radius: 50%;
			}

			.apple-btn {
				display: flex;
				align-items: center;
				justify-content: center;
				margin-left: 30rpx;
				background: #000;
				border-radius: 34rpx;
				font-size: 40rpx;

				.icon-s-pingguo {
					color: #fff;
					font-size: 40rpx;
				}
			}

			.iconfont {
				font-size: 40rpx;
				color: #fff;
			}

			.wx {
				margin-right: 30rpx;
				background-color: #61C64F;
			}

			.mima {
				background-color: #28B3E9;
			}

			.yanzheng {
				background-color: #F89C23;
			}

		}
	}
</style>
